﻿namespace Common
{
    #region usings

    using System.Collections.Generic;
    using System.Linq;

    #endregion

    public class CloneableList<T> : List<T>, ICloneable<CloneableList<T>>
        where T : ICloneable<T>
    {
        public CloneableList(IEnumerable<T> collection)
            : base(collection)
        {
        }

        #region Implemented Interfaces

        #region ICloneable<List<T>>

        public CloneableList()
        {
        }

        public List<T> CloneAsList()
        {
            return this.Select(entry => entry.Clone()).ToList();
        }

        public CloneableList<T> Clone()
        {
            return new CloneableList<T>(CloneAsList());
        }

        #endregion

        #endregion
    }
}